//
//  TwelveChapterViewController.m
//  CoreAnimation
//
//  Created by 张国文 on 16/11/3.
//  Copyright © 2016年 hangzhouyijiyin. All rights reserved.
//

#import "TwelveChapterViewController.h"
#import "LeaveScreenRenderViewController.h"
#import "LayerHugeCountViewController.h"
#import "LayerHugeCountUseOptimizeViewController.h"

@interface TwelveChapterViewController ()

@end

@implementation TwelveChapterViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor whiteColor];
    
    UIButton *firstButton = [UIButton buttonWithType:UIButtonTypeCustom];
    firstButton.frame = CGRectMake(0, 20, 360, 50);
    [firstButton setTitle:@"离屏渲染-运用CAShapeLayer解决性能问题" forState:UIControlStateNormal];
    [firstButton setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    firstButton.tag = 100;
    [firstButton addTarget:self action:@selector(clickJump:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:firstButton];
    
    UIButton *sectionButton = [UIButton buttonWithType:UIButtonTypeCustom];
    sectionButton.frame = CGRectMake(0, 70, 360, 50);
    [sectionButton setTitle:@"图层巨大数量-3D空间图层(无优化)" forState:UIControlStateNormal];
    [sectionButton setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    sectionButton.tag = 101;
    [sectionButton addTarget:self action:@selector(clickJump:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:sectionButton];
    
    // 大家不要点击这个按钮，因为代码没有编写好，滑动会崩溃
        UIButton *thirdButton = [UIButton buttonWithType:UIButtonTypeCustom];
        thirdButton.frame = CGRectMake(0, 120, 360, 50);
        [thirdButton setTitle:@"图层巨大数量-3D空间图层(有优化)" forState:UIControlStateNormal];
        [thirdButton setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
        thirdButton.tag = 102;
        [thirdButton addTarget:self action:@selector(clickJump:) forControlEvents:UIControlEventTouchUpInside];
        [self.view addSubview:thirdButton];
    //
    //    UIButton *progressAutoButton = [UIButton buttonWithType:UIButtonTypeCustom];
    //    progressAutoButton.frame = CGRectMake(0, 170, 360, 50);
    //    [progressAutoButton setTitle:@"流程自动化-模拟小球掉落" forState:UIControlStateNormal];
    //    [progressAutoButton setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    //    progressAutoButton.tag = 103;
    //    [progressAutoButton addTarget:self action:@selector(clickJump:) forControlEvents:UIControlEventTouchUpInside];
}

- (void)clickJump:(UIButton *)button
{
    switch (button.tag) {
        case 100:
        {
            LeaveScreenRenderViewController *leaveScreenRenderVC = [[LeaveScreenRenderViewController alloc] init];
            [self.navigationController pushViewController:leaveScreenRenderVC animated:YES];
            break;
        }
        case 101:
        {
            LayerHugeCountViewController *layerHugeCountVC = [[LayerHugeCountViewController alloc] init];
            [self presentViewController:layerHugeCountVC animated:YES completion:nil];
            break;
        }
        case 102:
        {
            LayerHugeCountUseOptimizeViewController *layerHugeCountUseOptimizeVC = [[LayerHugeCountUseOptimizeViewController alloc] init];
            [self presentViewController:layerHugeCountUseOptimizeVC animated:YES completion:nil];
            break;
        }
        case 103:
        {
            
            break;
        }
        default:
            break;
    }
}


@end
